﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="CashRegister.aspx.cs" Inherits="Purchases_CashRegister" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
    <title>Caja</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <h2>
        Caja<asp:ImageButton ID="imgAdd" runat="server" Height="16px" ImageUrl="~/Images/icon_add.png"
            OnClick="imgAdd_Click" />
    </h2>
    <asp:Panel ID="pnlPurchaseStock" runat="server">
        <asp:HiddenField ID="hdnPurchase" runat="server" />
        <asp:EntityDataSource ID="edsPurchaseProduct" runat="server" ConnectionString="name=ObligatorioDotNetEntities"
            DefaultContainerName="ObligatorioDotNetEntities" EnableDelete="True" EnableFlattening="False"
            EnableInsert="True" EnableUpdate="True" EntitySetName="PurchaseProducts" EntityTypeFilter="PurchaseProduct"
            Where="it.PurchaseId = @PurchaseId" >
            <WhereParameters>
                <asp:ControlParameter ControlID="hdnPurchase" ConvertEmptyStringToNull="true" Type="Int64"
                    Name="PurchaseId" PropertyName="Value" />
            </WhereParameters>
        </asp:EntityDataSource>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
            DataKeyNames="PurchaseId,ProductId" DataSourceID="edsPurchaseProduct" ForeColor="#333333"
            GridLines="None" onrowdatabound="GridView1_RowDataBound">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:CommandField ButtonType="Image" CancelImageUrl="~/Images/icon_cancel.png" 
                    EditImageUrl="~/Images/icon_edit.png" HeaderText="Editar" ShowEditButton="True" 
                    UpdateImageUrl="~/Images/icon_ok.png" />
                <asp:BoundField DataField="PurchaseId" HeaderText="PurchaseId" ReadOnly="True" SortExpression="PurchaseId"
                    ConvertEmptyStringToNull="False" Visible="False" />
                <asp:BoundField DataField="ProductId" HeaderText="ProductId" ReadOnly="True" SortExpression="ProductId"
                    ConvertEmptyStringToNull="False" Visible="False" />
                <asp:TemplateField HeaderText="Producto">
                    <EditItemTemplate>
                        <asp:Label ID="lblProduct" runat="server"></asp:Label></EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label ID="lblProduct" runat="server"></asp:Label></ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="Quantity" HeaderText="Cantidad" SortExpression="Quantity" />
                <asp:CommandField ButtonType="Image" DeleteImageUrl="~/Images/icon_delete.png" 
                    HeaderText="Borrar" ShowDeleteButton="True" />
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
        <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" CellPadding="4"
            DefaultMode="Insert" ForeColor="#333333" GridLines="None" Height="50px" Width="125px"
            OnItemInserting="DetailsView1_ItemInserting" Visible="False">
            <AlternatingRowStyle BackColor="White" />
            <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
            <EditRowStyle BackColor="#2461BF" />
            <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
            <Fields>
                <asp:TemplateField HeaderText="Producto">
                    <InsertItemTemplate>
                        <asp:DropDownList ID="ddlProducts" runat="server" DataValueField="ProductId" DataTextField="ProductDesctiption">
                        </asp:DropDownList>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Cantidad">
                    <InsertItemTemplate>
                        <asp:TextBox ID="txtQuantity" runat="server"></asp:TextBox>
                    </InsertItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowInsertButton="True" />
            </Fields>
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
        </asp:DetailsView>
    </asp:Panel>
    <asp:EntityDataSource ID="edsProducts" runat="server" ConnectionString="name=ObligatorioDotNetEntities"
        DefaultContainerName="ObligatorioDotNetEntities" EnableFlattening="False" EntitySetName="ProductStocks"
        EntityTypeFilter="Product">
    </asp:EntityDataSource>
</asp:Content>
